package com.bwie.controller;
import com.bwie.pojo.GroupJoin;
import com.bwie.service.GroupJoinService;
import com.bwie.service.impl.GroupJoinServiceImpl;
import com.bwie.utils.R;
import com.bwie.vo.PageInfoVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.multipart.MultipartFile;

/**
* (tb_group_join)表控制层
*
* @author xxxxx
*/
@RestController
@RequestMapping("/group/join")
@Api(tags = "参与拼团活动管理")
public class GroupJoinController {
/**
* 服务对象
*/
    @Autowired
    private GroupJoinService groupJoinService;

    /**
     * @author: LiuWeiChen
     * @description:
     * @params: 参与拼团活动列表
     * @return:
     * @date: 2025/7/27 14:01
     */
    @ApiOperation("参与拼团活动列表")
    @PostMapping("/joinActiveList")
    public R joinActiveList(@RequestBody PageInfoVo pageInfoVo){
        return groupJoinService.joinActiveList(pageInfoVo);
    }

    /**
     * @author: LiuWeiChen
     * @description:
     * @params: 修改拼团活动列表
     * @return:
     * @date: 2025/7/27 14:18
     */
    @ApiOperation("修改拼团活动列表")
    @PostMapping("/updateJoinActive")
    public R updateJoinActive(@RequestBody @Validated GroupJoin groupJoin, BindingResult result){
        return groupJoinService.updateJoinActive(groupJoin,result);
    }

    /**
     * @author: LiuWeiChen
     * @description:
     * @params: 图片上传
     * @return:
     * @date: 2025/7/27 14:43
     */
    @ApiOperation("图片上传")
    @PostMapping("/uploadFile")
    public R uploadFile(@RequestPart("file")MultipartFile file){
        return groupJoinService.uploadFile(file);
    }

    /**
     * @author: LiuWeiChen
     * @description:
     * @params: 添加拼团活动列表
     * @return:
     * @date: 2025/7/27 14:50
     */
    @ApiOperation("添加拼团活动列表")
    @PostMapping("/addGroupJoin")
    public R addGroupJoin(@RequestBody @Validated GroupJoin groupJoin,BindingResult result){
        return groupJoinService.addGroupJoin(groupJoin,result);
    }

    /**
     * @author: LiuWeiChen
     * @description:
     * @params: 删除拼团活动
     * @return:
     * @date: 2025/7/27 14:56
     */
    @ApiOperation("删除拼团活动")
    @PostMapping("/deleteGroupJoin")
    public R deleteGroupJoin(@RequestBody GroupJoin groupJoin){
        return groupJoinService.deleteGroupJoin(groupJoin);
    }


}
